package com.tokenplus.thai.earn.rules.adapter

import android.annotation.SuppressLint
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.tokenplus.thai.R

class EarnRulesAdapter(private val dataList: List<DataEarnRules>) :
    RecyclerView.Adapter<EarnRulesAdapter.ViewHolder>() {

    inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
        var textAdapterEarnRules: TextView =
            view.findViewById(R.id.textAdapterEarnRules)
    }

    override fun onCreateViewHolder(
        parent: ViewGroup,
        viewType: Int,
    ): ViewHolder {
        val view = LayoutInflater.from(parent.context)
            .inflate(R.layout.view_adpter_earn_rules, parent, false)
        return ViewHolder(view)
    }

    @SuppressLint("SetTextI18n")
    override fun onBindViewHolder(holder: ViewHolder, position: Int) {
        val data: DataEarnRules = dataList[position]
        holder.textAdapterEarnRules.text = data.rule

    }

    override fun getItemCount(): Int {
        return dataList.size
    }
}